Ext.define('jwawa.erp.cfg.entity.EntityShell', {
    extend: 'jwawa.erp.framework.ShellContainer',
    alias: 'widget.entityShell',
    handlerClass: 'jwawa.erp.cfg.entity.EntityHandler',
    dockedItems: [
        {
            xtype: 'toolbar',
            dock: 'top',
            items: [
                {
                    itemId: 'saveEntityButton',
                    xtype: 'button',
                    text: '保存',
                    icon: '/img/disk.png',
                    disabled: true
                },
                {
                    itemId: 'newEntityButton',
                    xtype: 'button',
                    icon: '/img/book_add.png',
                    text: '新增'
                },
                {
                    itemId: 'delEntityButton',
                    xtype: 'button',
                    text: '删除',
                    icon: '/img/book_delete.png',
                    disabled: true
                },
                {
                    xtype: 'tbseparator'
                },
                {
                    itemId: 'refreshButton',
                    xtype: 'button',
                    text: '刷新',
                    icon: '/img/arrow_refresh.png',
                    disabled: true
                },
                {
                    itemId: 'returnButton',
                    xtype: 'button',
                    icon: '/img/door_out.png',
                    text: '返回'
                },
                {
                    xtype: 'tbspacer',
                    flex: 1,
                    autoScroll: false
                },
                {
                    xtype: 'label',
                    text: '基本信息',
                    cls: 'toolbar-title',
                    padding: 3
                }
            ]
        }
    ],
    items: [
        {
            itemId: 'entityPanel',
            xtype: 'panel',
            border: false,
            disabled: true,
            layout: {type: 'border'},
            items: [
                {
                    itemId:'entityHeaderFormPanel',
                    xtype: 'form',
                    height: 80,
                    minHeight: 25,
                    bodyPadding: 10,
                    collapsible: false,
                    layout: {type: 'column'},
                    preventHeader: true,
                    region: 'north',
                    split: true,
                    border: false,
                    fieldDefaults:{
                        labelWidth: 60,
                        margin: '3',
                        columnWidth: 0.25,
                        entity: 'cfg_entity_headers',
                        selectOnFocus: true
                    },
                    componentCls: 'boxLineBottom',
                    plugins:[{ptype: 'jwawaSubmitPlugin'}],
                    items: [
                        {
                            itemId: 'idField',
                            name: 'id',
                            xtype: 'hiddenfield',
                            labelWidth: 0,
                            margin: '0',
                            columnWidth: 0
                        },
                        {
                            itemId: 'entityCodeField',
                            name: 'entity_code',
                            xtype: 'textfield',
                            fieldLabel: '实体编码',
                            selectOnFocus: true,
                            allowBlank: false,
                            kbNav: true
                        },
                        {
                            name:'entity_name',
                            xtype: 'textfield',
                            fieldLabel: '实体名称',
                            selectOnFocus: true,
                            allowBlank: false,
                            kbNav: true,
                            kbSubmit: true
                        },
                        {
                            name:'create_time',
                            xtype: 'textfield',
                            fieldLabel: '创建时间',
                            readOnly: true,
                            fieldCls: 'readonly-field',
                            submitValue: false
                        },
                        {
                            name:'create_by',
                            xtype: 'textfield',
                            fieldLabel: '创建人',
                            readOnly: true,
                            fieldCls: 'readonly-field',
                            submitValue: false
                        },
                        {
                            name:'update_time',
                            xtype: 'textfield',
                            fieldLabel: '更新时间',
                            readOnly: true,
                            fieldCls: 'readonly-field',
                            submitValue: false
                        },
                        {
                            name:'update_by',
                            xtype: 'textfield',
                            fieldLabel: '更新人',
                            readOnly: true,
                            fieldCls: 'readonly-field',
                            submitValue: false
                        }
                    ]
                },
                {
                    itemId:'entityDetailGridPanel',
                    xtype: 'gridpanel',
                    region: 'center',
                    border: false,
                    selType: 'rowmodel',
                    componentCls: 'boxLineTop',
                    sortableColumns: false,
                    columns: [
                        {
                            id: 'id',
                            xtype: 'rownumberer',
                            width: 30,
                            sortable: false
                        },
                        {
                            dataIndex: 'entity_field_name',
                            width: 150,
                            text: '属性名称'
                        },
                        {
                            dataIndex: 'entity_field_label',
                            width: 200,
                            text: '属性标签'
                        },
                        {
                            dataIndex: 'sql_field',
                            width: 100,
                            text: 'SQL域'
                        }
                    ],
                    dockedItems: [
                        {
                            xtype: 'toolbar',
                            dock: 'top',
                            items: [
                                {
                                    itemId: 'editEntityDetailButton',
                                    xtype: 'button',
                                    text: '编辑',
                                    icon: '/img/page_edit.png',
                                    disabled: true
                                },
                                {
                                    itemId: 'newEntityDetailButton',
                                    xtype: 'button',
                                    text: '新增',
                                    icon: '/img/page_add.png',
                                    disabled: true
                                },
                                {
                                    itemId: 'delEntityDetailButton',
                                    xtype: 'button',
                                    text: '删除',
                                    icon: '/img/page_delete.png',
                                    disabled: true
                                },
                                {
                                    xtype: 'tbspacer',
                                    flex: 1,
                                    autoScroll: false
                                },
                                {
                                    xtype: 'label',
                                    text: '明细列表',
                                    cls: 'toolbar-title'
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
});